Fastbin Attack 是一種 Heap Exploitation 技術,主要針對 小型 chunk(≤0x80, x86_64)。
透過操控 fastbin freelist,可以實現 任意地址寫入,進而覆蓋函數指標、GOT entry 或 hook,達到遠程程式控制(RCE)。
system("/bin/sh")
,取得 shellIndex | Chunk Size | Status | 所在位置 | 備註 |
---|---|---|---|---|
0 | 0x30 | freed | fastbin | 用於 fastbin attack |
1 | 0x30 | freed | fastbin | fd 改寫成目標地址 |
2 | 0x30 | allocated | malloc → target | 任意寫入地址 |
3 | 0x30 | allocated | malloc → payload | 寫入 system 或 ROP gadget |
Fastbin 狀態示意:
Before fd overwrite:
fastbin[0x30]: chunk1 -> chunk0 -> NULL
After fd overwrite (fd → target):
fastbin[0x30]: target -> chunk0 -> NULL
malloc(0x30) → returns target
malloc(0x30) → returns chunk0